const app = getApp()

const { dataByIdApi } = require('../../../api/services/yhHidden/index')

Page({
  data: {
    id: '',
    info: {},
    list: [],
    YHZG_Edit: null,
    YHPC_Edit: null,
  },

  // 跳转排查项
  handlePCX() {
    let troubleId = this.data.info.id
    wx.navigateTo({ url: '/pages/safety/yhAdd/yhAdd?troubleId=' + troubleId })
  },

  // 获取详情
  async getDescData() {
    let params = { id: this.data.id }
    const res = await dataByIdApi(params)
    if (res.code != 200) {
      return app.toast(res.msg)
    }
    this.setData({ info: res.data.info, list: res.data.list })
  },

  //排查项 问题点
  handlePoint(event) {
    let { item } = event.currentTarget.dataset
    let itemStr = JSON.stringify(item)
    wx.navigateTo({ url: '/pages/common/point/point?item=' + itemStr })
  },

  onLoad: function (options) {
    this.setData({ id: options.id, statusForm: true })
  },

  onShow: function () {
    this.setData({ YHZG_Edit: wx.getStorageSync('YHZG_Edit'), YHPC_Edit: wx.getStorageSync('YHPC_Edit') })
    this.getDescData()
  },
})
